```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分布式ID生成方案全解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
            background-color: #f9f9f9;
        }
        .serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(110, 142, 251, 0.2);
            z-index: -1;
            transition: height 0.3s ease;
        }
        .highlight:hover:after {
            height: 50%;
        }
        .table-container {
            overflow-x: auto;
        }
        .table-container table {
            min-width: 800px;
        }
        .mermaid {
            background-color: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col items-center text-center">
                <h1 class="text-4xl md:text-5xl font-bold mb-6 serif">分布式ID生成方案全解析</h1>
                <p class="text-xl md:text-2xl opacity-90 mb-8 max-w-3xl">探索高效、可靠的分布式系统唯一标识生成方法</p>
                <div class="w-full max-w-3xl mx-auto bg-white bg-opacity-20 rounded-lg p-6 backdrop-filter backdrop-blur-sm">
                    <p class="text-lg md:text-xl">"在分布式系统中，唯一标识（ID）是必不可少的。例如，在订单系统、用户管理、日志跟踪等场景下，我们都需要一个全局唯一的 ID 来标识不同的数据。"</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Section 1: What is Distributed ID -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-purple-600 mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800 serif">1. 什么是分布式 ID？</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1741098115840-db16ce05-719d-420d-a004-a3c0d476d92e.png" alt="分布式ID概念图" class="w-full h-auto">
            </div>
            <p class="text-lg text-gray-700 mb-6">分布式 ID 是在多个节点上生成的唯一标识符，必须满足以下特性：</p>
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="bg-white p-6 rounded-lg shadow-sm border-l-4 border-purple-500">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">核心特性</h3>
                    <ul class="space-y-2 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span><strong>全局唯一性</strong>：不同节点生成的 ID 不能重复</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span><strong>有序性</strong>：部分场景要求 ID 按时间有序递增</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span><strong>高性能</strong>：生成 ID 的速度不能成为系统瓶颈</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white p-6 rounded-lg shadow-sm border-l-4 border-blue-500">
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">附加特性</h3>
                    <ul class="space-y-2 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span><strong>高可用性</strong>：即使部分节点宕机，仍然能够生成 ID</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span><strong>安全性</strong>：避免被恶意猜测或篡改</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Section 2: Distributed ID Generation Solutions -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-blue-600 mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800 serif">2. 分布式 ID 生成方案</h2>
            </div>
            
            <!-- Solution 2.1 -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-10 card-hover">
                <div class="p-6 md:p-8">
                    <div class="flex items-start mb-4">
                        <div class="bg-blue-100 text-blue-800 rounded-full w-10 h-10 flex items-center justify-center mr-4 flex-shrink-0">
                            <span class="font-bold">1</span>
                        </div>
                        <div>
                            <h3 class="text-2xl font-bold text-gray-800 mb-2">数据库自增 ID</h3>
                            <div class="flex flex-wrap gap-2 mb-4">
                                <span class="px-3 py-1 bg-blue-100 text-blue-800 text-sm rounded-full">简单</span>
                                <span class="px-3 py-1 bg-blue-100 text-blue-800 text-sm rounded-full">单机</span>
                                <span class="px-3 py-1 bg-red-100 text-red-800 text-sm rounded-full">扩展性差</span>
                            </div>
                        </div>
                    </div>
                    <div class="pl-14">
                        <p class="text-gray-700 mb-4"><strong>方案描述：</strong>利用数据库的自增主键（如 MySQL 的 <code class="bg-gray-100 px-2 py-1 rounded">AUTO_INCREMENT</code>）来生成唯一 ID。</p>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-green-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-green-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-up mr-2"></i>优点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>简单易用，适用于小规模应用</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>ID 递增，方便数据库索引优化</span>
                                    </li>
                                </ul>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-red-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-down mr-2"></i>缺点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>数据库单点压力大，扩展性差</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>高并发场景下可能会成为性能瓶颈</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>依赖数据库，受可用性影响</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <h4 class="font-semibold text-yellow-800 mb-2 flex items-center">
                                <i class="fas fa-lightbulb mr-2"></i>优化方案
                            </h4>
                            <p class="text-gray-700">使用多个数据库分段递增（如 ID 1-1000 由 A 负责，1001-2000 由 B 负责）</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Solution 2.2 -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-10 card-hover">
                <div class="p-6 md:p-8">
                    <div class="flex items-start mb-4">
                        <div class="bg-purple-100 text-purple-800 rounded-full w-10 h-10 flex items-center justify-center mr-4 flex-shrink-0">
                            <span class="font-bold">2</span>
                        </div>
                        <div>
                            <h3 class="text-2xl font-bold text-gray-800 mb-2">UUID（通用唯一识别码）</h3>
                            <div class="flex flex-wrap gap-2 mb-4">
                                <span class="px-3 py-1 bg-purple-100 text-purple-800 text-sm rounded-full">无依赖</span>
                                <span class="px-3 py-1 bg-purple-100 text-purple-800 text-sm rounded-full">分布式</span>
                                <span class="px-3 py-1 bg-red-100 text-red-800 text-sm rounded-full">无序</span>
                            </div>
                        </div>
                    </div>
                    <div class="pl-14">
                        <p class="text-gray-700 mb-4"><strong>方案描述：</strong>使用 Java 自带的 <code class="bg-gray-100 px-2 py-1 rounded">UUID.randomUUID()</code> 生成 128 位的随机 ID。</p>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-green-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-green-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-up mr-2"></i>优点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>生成速度快，不依赖外部存储</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>适用于分布式环境</span>
                                    </li>
                                </ul>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-red-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-down mr-2"></i>缺点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>ID 较长，占用存储空间较大（一般为 32 位字符串）</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>不能保证有序性，影响数据库索引效率</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <h4 class="font-semibold text-yellow-800 mb-2 flex items-center">
                                <i class="fas fa-lightbulb mr-2"></i>优化方案
                            </h4>
                            <p class="text-gray-700">采用 Base62 编码，减少字符串长度</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Solution 2.3 -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-10 card-hover">
                <div class="p-6 md:p-8">
                    <div class="flex items-start mb-4">
                        <div class="bg-red-100 text-red-800 rounded-full w-10 h-10 flex items-center justify-center mr-4 flex-shrink-0">
                            <span class="font-bold">3</span>
                        </div>
                        <div>
                            <h3 class="text-2xl font-bold text-gray-800 mb-2">Redis 生成 ID</h3>
                            <div class="flex flex-wrap gap-2 mb-4">
                                <span class="px-3 py-1 bg-red-100 text-red-800 text-sm rounded-full">高性能</span>
                                <span class="px-3 py-1 bg-red-100 text-red-800 text-sm rounded-full">分布式</span>
                                <span class="px-3 py-1 bg-yellow-100 text-yellow-800 text-sm rounded-full">依赖Redis</span>
                            </div>
                        </div>
                    </div>
                    <div class="pl-14">
                        <p class="text-gray-700 mb-4"><strong>方案描述：</strong>使用 Redis 的 <code class="bg-gray-100 px-2 py-1 rounded">INCR</code> 命令生成自增 ID。</p>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-green-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-green-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-up mr-2"></i>优点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>高并发下性能优越</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>ID 递增，索引友好</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>依赖 Redis，易于扩展和管理</span>
                                    </li>
                                </ul>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-red-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-down mr-2"></i>缺点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>需要保证 Redis 的高可用性，否则可能出现 ID 生成失败</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>可能有网络延迟影响</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <h4 class="font-semibold text-yellow-800 mb-2 flex items-center">
                                <i class="fas fa-lightbulb mr-2"></i>优化方案
                            </h4>
                            <p class="text-gray-700">使用 Redis 集群或主从复制，提升可用性</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Solution 2.4 -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-10 card-hover">
                <div class="p-6 md:p-8">
                    <div class="flex items-start mb-4">
                        <div class="bg-green-100 text-green-800 rounded-full w-10 h-10 flex items-center justify-center mr-4 flex-shrink-0">
                            <span class="font-bold">4</span>
                        </div>
                        <div>
                            <h3 class="text-2xl font-bold text-gray-800 mb-2">雪花算法（Snowflake）</h3>
                            <div class="flex flex-wrap gap-2 mb-4">
                                <span class="px-3 py-1 bg-green-100 text-green-800 text-sm rounded-full">高性能</span>
                                <span class="px-3 py-1 bg-green-100 text-green-800 text-sm rounded-full">分布式</span>
                                <span class="px-3 py-1 bg-green-100 text-green-800 text-sm rounded-full">有序</span>
                                <span class="px-3 py-1 bg-yellow-100 text-yellow-800 text-sm rounded-full">依赖时钟</span>
                            </div>
                        </div>
                    </div>
                    <div class="pl-14">
                        <p class="text-gray-700 mb-4"><strong>方案描述：</strong>雪花算法由 Twitter 提出，是一种 64 位的分布式 ID 生成方案。</p>
                        
                        <!-- Snowflake Structure Visualization -->
                        <div class="mb-6">
                            <div class="mermaid">
                                graph LR
                                    A[0] --> B[41-bit 时间戳]
                                    B --> C[10-bit 机器 ID]
                                    C --> D[12-bit 计数器]
                            </div>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-green-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-green-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-up mr-2"></i>优点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>ID 递增，索引友好</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>适用于高并发场景</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>本地计算，性能高</span>
                                    </li>
                                </ul>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-red-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-down mr-2"></i>缺点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>依赖服务器时间，如果时钟回拨可能导致重复 ID</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <h4 class="font-semibold text-yellow-800 mb-2 flex items-center">
                                <i class="fas fa-lightbulb mr-2"></i>优化方案
                            </h4>
                            <ul class="text-gray-700 space-y-2">
                                <li class="flex items-start">
                                    <i class="fas fa-cog text-yellow-500 mt-1 mr-2"></i>
                                    <span>增加时钟回拨检测和补偿机制</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-cog text-yellow-500 mt-1 mr-2"></i>
                                    <span>采用 NTP 服务器同步时间</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Solution 2.5 -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-10 card-hover">
                <div class="p-6 md:p-8">
                    <div class="flex items-start mb-4">
                        <div class="bg-indigo-100 text-indigo-800 rounded-full w-10 h-10 flex items-center justify-center mr-4 flex-shrink-0">
                            <span class="font-bold">5</span>
                        </div>
                        <div>
                            <h3 class="text-2xl font-bold text-gray-800 mb-2">美团 Leaf 分布式 ID 方案</h3>
                            <div class="flex flex-wrap gap-2 mb-4">
                                <span class="px-3 py-1 bg-indigo-100 text-indigo-800 text-sm rounded-full">企业级</span>
                                <span class="px-3 py-1 bg-indigo-100 text-indigo-800 text-sm rounded-full">高可用</span>
                                <span class="px-3 py-1 bg-yellow-100 text-yellow-800 text-sm rounded-full">依赖服务</span>
                            </div>
                        </div>
                    </div>
                    <div class="pl-14">
                        <p class="text-gray-700 mb-4"><strong>方案描述：</strong>Leaf 是美团开源的分布式 ID 生成系统，支持 <strong>号段模式</strong> 和 <strong>雪花算法模式</strong>。</p>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-green-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-green-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-up mr-2"></i>优点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>适用于大规模应用</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>提供高可用保障</span>
                                    </li>
                                </ul>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg">
                                <h4 class="font-semibold text-red-800 mb-2 flex items-center">
                                    <i class="fas fa-thumbs-down mr-2"></i>缺点
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-times text-red-500 mt-1 mr-2"></i>
                                        <span>需要额外的 ID 服务组件</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Section 3: Comparison and Selection -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800 serif">3. 方案对比与选择</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <div class="table-container">
                        <table class="w-full">
                            <thead>
                                <tr class="bg-gray-100 text-left text-gray-700">
                                    <th class="p-4 font-semibold">方案</th>
                                    <th class="p-4 font-semibold">唯一性</th>
                                    <th class="p-4 font-semibold">有序性</th>
                                    <th class="p-4 font-semibold">性能</th>
                                    <th class="p-4 font-semibold">依赖性</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y divide-gray-200">
                                <tr class="hover:bg-gray-50">
                                    <td class="p-4 font-medium">数据库自增 ID</td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-times text-red-500"></i></td>
                                    <td class="p-4">依赖数据库</td>
                                </tr>
                                <tr class="hover:bg-gray-50">
                                    <td class="p-4 font-medium">UUID</td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-times text-red-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4">无依赖</td>
                                </tr>
                                <tr class="hover:bg-gray-50">
                                    <td class="p-4 font-medium">Redis 自增</td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4">依赖 Redis</td>
                                </tr>
                                <tr class="hover:bg-gray-50">
                                    <td class="p-4 font-medium">雪花算法</td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4">依赖时钟</td>
                                </tr>
                                <tr class="hover:bg-gray-50">
                                    <td class="p-4 font-medium">Leaf</td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4"><i class="fas fa-check text-green-500"></i></td>
                                    <td class="p-4">依赖 ID 服务</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-6">
                <div class="bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>选型建议
                    </h3>
                    <ul class="space-y-3 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-circle text-xs text-blue-500 mt-2 mr-2"></i>
                            <span><strong>小型项目：</strong>数据库自增 ID 适用于小规模应用</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-circle text-xs text-purple-500 mt-2 mr-2"></i>
                            <span><strong>无依赖场景：</strong>UUID 适合离线环境，但 ID 过长</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-circle text-xs text-red-500 mt-2 mr-2"></i>
                            <span><strong>高并发：</strong>推荐 Redis 或雪花算法</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                            <span><strong>大规模应用：</strong>Leaf 提供更完善的解决方案</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-project-diagram text-blue-500 mr-2"></i>决策流程图
                    </h3>
                    <div class="mermaid">
                        graph TD
                            A[开始] --> B{项目规模?}
                            B -->|小型| C[数据库自增ID]
                            B -->|中大型| D{是否需要有序ID?}
                            D -->|是| E{高并发?}
                            D -->|否| F[UUID]
                            E -->|是| G[雪花算法/Redis]
                            E -->|否| H[Leaf号段模式]
                            G --> I{时钟可靠?}
                            I -->|是| J[雪花算法]
                            I -->|否| K[Redis]
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索技术的无限可能</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="flex items-center text-gray-300 hover:text-white transition-colors">
                        <i class="fas fa-globe mr-2"></i>
                        <span>http://www.yuque.com/jtostring</span>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                <p>© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```